package usi.ch.onto.common;

import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class FileUtils {
	public static String getDocUuid(File f) throws UnsupportedEncodingException,
			IOException, NoSuchAlgorithmException {
		byte[] uuid = f.getCanonicalPath().getBytes("UTF-8");
		MessageDigest md;
		md = MessageDigest.getInstance("MD5");
		byte[] digest = md.digest(uuid);
		BigInteger bigInt = new BigInteger(1, digest);
		return bigInt.toString(16);
	}
}
